package com.factory_strategy_template;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

public class HandlerFactory {

    private static Map<String,Handler> handlerMap = new HashMap<>();

    public static Handler getInvokeStrategy(String str){

        return handlerMap.get(str);

    }


    public static void registerHandler(String str,Handler handler){
         if(StringUtils.isEmpty(str) && handler != null){
             return;
         }
        handlerMap.put(str,handler);
    }
}
